<?php

class Gallery extends Module
{
	function __construct ($db){
		$this->set_db($db);
	}

	function get_all_gallery(){
		$result = $this->get_all("gallery");

		foreach($result as $k => $v){
			$result[$k]["detail_th"] = nl2br($v["detail_th"]);
			$result[$k]["detail_en"] = nl2br($v["detail_en"]);
			$result[$k]["warning_th"] = nl2br($v["warning_th"]);
			$result[$k]["warning_en"] = nl2br($v["warning_en"]);
		}

		return $result;
	}

	function get_gallery($gid){
		$result = $this->get("gallery", "gid='$gid'");
		$result["detail_th"] = nl2br($result["detail_th"]);
		$result["detail_en"] = nl2br($result["detail_en"]);
		$result["warning_th"] = nl2br($result["warning_th"]);
		$result["warning_en"] = nl2br($result["warning_en"]);
		 return $result;
	}

	function get_all_picture($gid){
		return $this->get_all("gallery_picture", "gid='$gid'");
	}

	function get_min(){
		return $this->db->minOf("gid","gallery",1);
	}
}

?>